package org.elephas.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.elephas.webapp.component.Theme;
import org.elephas.webapp.component.themes.BlueTheme;
import org.elephas.webapp.component.themes.DefaultTheme;
import org.springframework.stereotype.Service;

/**
 * Created Apr 6, 2008
 * 
 * @author <a href="mailto:jlee@antwerkz.com">Justin Lee</a>
 */
@Service
public class ThemeFinder {
	Map<String, Theme> themes = new ConcurrentHashMap<String, Theme>();

	{
		themes.put("default", new DefaultTheme());
		themes.put("blue", new BlueTheme());
	}

	public List<Theme> listThemes() {
		return new ArrayList<Theme>(themes.values());
	}

	public Theme getTheme(String name) {
		Theme theme = themes.get(name);
		if (theme == null) {
			return new DefaultTheme();
		}
		return theme;
	}
}
